    function pi = makepi(states,fixedparms,beliefparms)
    % form the beliefs (pi) for each state
      index=...
          beliefparms.theta(1)... % constant
          +beliefparms.theta(2).*(states(:,1)-12) ... % age
          +beliefparms.theta(3).*(states(:,2)-7) ... % education
          +beliefparms.theta(4).*(states(:,2)-7).^2 ... % education2
          +beliefparms.theta(5).*(states(:,2)==13) ... % college
          +beliefparms.theta(6).*(states(:,2)-7).*(states(:,1)-12); % age x education interaction

      pi=[beliefparms.gamma.*(1+beliefparms.gamma_mod.*(states(:,1)>17)).*(1+beliefparms.theta(end).*(fixedparms.ind_goodgirl==0)).*(1-normcdf(index)), beliefparms.gamma.*(1+beliefparms.gamma_mod.*(states(:,1)>17)).*(1+beliefparms.theta(end).*(fixedparms.ind_goodgirl==0)).*normcdf(index)];
  
    end
    